Repository navigation
Conversation
MESA_convergence_criterion declares a bin whose salts have all dissolved fully liquid (upper hysteresis curve) only if its crustal solids (OIN, CaCO3, CaSO4) are at most xhyst_up_crustal_thresh = 0.30 of its dry mass. The reason given with the parameter is that in a sectional or modal model dust is mostly externally mixed within a bin, so a minor dust fraction should not control the water of the whole bin. In PartMC each bin is one particle, so that reason does not apply, and a dust-rich particle whose salts have dissolved stays "mixed" on the lower curve indefinitely. When MOSAIC is coupled to PartMC (m_partmc_mosaic > 0, the flag PartMC's mosaic_init sets and the other PartMC-specific branches of MOSAIC already test) the threshold is now xhyst_up_crustal_thresh_partmc = 1.0 (no restriction): such a particle goes to the upper curve like any other. The MOSAIC box model and other hosts (m_partmc_mosaic <= 0) are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PartMC: no crustal-fraction limit on the upper hysteresis curve
Branch
crustal-threshold-particle-resolved(one commit onpartmc-libraryat 2c5e006, i.e. after PR #2). Files:MOSAIC_v2/aerosol/module_mosaic_ext.f90(+12 -3, inMESA_convergence_criterion),MOSAIC_v2/datamodules/module_data_mosaic_aero.f90(+6: the parameterxhyst_up_crustal_thresh_partmc = 1.0_r8and its comment).Problem
MESA_convergence_criteriondeclares a bin whose salts have all dissolved(
sumflux = 0) fully liquid, i.e. on the upper hysteresis curve, only ifits crustal solids (OIN, CaCO3, CaSO4) are at most
xhyst_up_crustal_thresh = 0.30of its dry mass. The comment with theparameter gives the reason: in a sectional or modal model mineral dust is
mostly externally mixed within a bin, so a minor dust fraction will reside
in a minor fraction of the bin's particles and should not control the
bin's water (earlier MOSAIC versions used 0.0).
In PartMC every bin is one particle, so the averaging argument does not
apply: the crustal material is in the particle itself. A dust-rich
particle (more than 30% crustal) whose salts have all dissolved is then
never put on the upper curve. It stays "mixed" on the lower curve with no
solid salt, is solid again below its MDRH (instead of staying liquid down
to its CRH, as other particles that deliquesced do), and is deliquesced
from scratch and handed to
MESA_PTCagain in every phase-stateevaluation, where
MESA_PTCfinds in one iteration that there is nothingto do.
Measurements
PartMC (
update_mosaic, 1716875) linked against MOSAIC built ascompile.shdoes for gfortran (-O2 -g -fallow-argument-mismatch,gfortran 14.3, Perlmutter CPU node). Urban plume scenario, 24 h, 10000
particles, del_t 60 s, hourly output,
rand_init 7, coagulation off. Withcoagulation off and flat (or flat_source) weighting no random decision of PartMC depends on
the particles' composition, so every run has the same particles (checked:
the particle ids agree in every output) and the differences between runs
come from the chemistry alone. Numbers: largest relative difference over
the 24 hourly outputs.
The current code has run-to-run noise of 1e-3 to 1e-2 in the bulk species
from the switch at XT = 2 (companion PR
xt-roundoff-tolerance), largerthan the effect of this change in most quantities. So the change is
measured on top of the companion branch: "effect" is the merge of both
branches against
xt-roundoff-tolerancealone; "noise" isxt-roundoff-tolerancewith the particles handed to MOSAIC in a differentrandom order at every step (a test-only change of PartMC's
mosaic_from_partmc/mosaic_to_partmc; see the companion PR) against thesame without. Four scenarios: as it is (flat weighting, initial RH 95%;
few dust particles),
weight_type flat_source(one flat weight persource, so that the rare paved-road dust emission gets its share of the
computational particles), and initial RH 80% and 60%.
flat_sourceSo with
flat_sourceweighting one in eight particle-outputs moves to theupper curve (the dust-rich particles whose salts have dissolved; 53% -> 66%
of the particles on the upper curve). The gases and the bulk NO3, NH4 and
Cl change by no more than the noise; bulk water changes by up to 0.2%
(RH 80%: hours 11 and 12; RH 60%: hours 11 to 16; as it is: 8e-5 in hours
11 to 16), where the noise is 1e-6 or less.
Alone against
partmc-libraryas it is, the change is hidden in thecurrent noise: as it is, the largest differences (gas NH3 5.0e-3, bulk NO3
7e-4, H2O 7e-4) are of the size of the shuffled-order noise of the current
code or below it (two seeds: NH3 3.2e-3, 4.8e-3; NO3 8e-3, 1e-2; H2O 3e-3,
2e-3); with
flat_sourcethey are two to three times the noise of oneshuffled run (gas NH3 9.2e-3, bulk NO3 3e-3, H2O 2e-3 against 5.5e-3,
1e-3, 1e-3), and
35469 particle-outputs move to the upper curve (0.533 -> 0.659), as on top
of the companion branch.
Cost (wall time of the 24 h runs, side by side on one node, so +-1 to 2%):
as it is 336 s with the change against 334 s without (on top of the
companion branch; 332 s against 332 s alone);
flat_source250 s against263 s (248 s against 258 s alone), i.e. 4 to 5% faster, presumably
because the dust-rich particles no longer go through
MESA_PTCat everyevaluation (not profiled);
RH 80% 290 s against 291 s; RH 60% 138 s against 137 s.
The change
! PartMC: each bin is one particle (see module_data_mosaic_aero) if (m_partmc_mosaic > 0) then crustal_thresh = xhyst_up_crustal_thresh_partmc ! 1.0 else crustal_thresh = xhyst_up_crustal_thresh ! 0.30 endif if ( sumflux .eq. 0.0 .and. & crustal_solids .le. crustal_thresh*(mass_dry_a(ibin)*1.0e15) ) thenWhy this form. The change should apply where each bin is a single
particle, and nowhere else. Choices considered:
mSIZE_FRAMEWORK == mUNSTRUCTURED: PartMC sets it, but so does theMOSAIC box model's own example input (
case1.inp:msize_framework = 2), where a bin is a population. Not used.PartMC's
mosaic_init(PartMC'ssrc/mosaic.F90sets MOSAIC's modulevariables directly; MOSAIC has no PartMC initialisation routine of its
own), i.e. a second PR in another repository.
m_partmc_mosaic > 0(chosen): MOSAIC's existing flag for "coupled toPartMC". PartMC's
mosaic_initsets it to 100, the MOSAIC box model'sreadinputfilesets it to 0, and MOSAIC already uses it for the otherPartMC-specific branches (
module_mosaic_aerdynam_intr,module_mosaic_init_aerosol,module_pmcmos_aer,mosaic_allocate_memory). No change to PartMC is needed, and the boxmodel and the sectional/modal uses are unchanged.
1.0 means no restriction: crustal_solids <= the whole dry mass always
holds. (The comparison is kept, so that the expression is the same as
before for the other hosts.)
What was checked
for 24 h with it, alone and merged with
xt-roundoff-tolerance, in thefour scenarios above.
xt-roundoff-tolerance.Left for the reviewer to judge
its water down to its crystallisation point (CRH) on drying, like any
other particle that deliquesced, instead of losing it at its MDRH. We
think that is right for a single particle (there is no hidden external
mixture to average over), but it is a change of the model.
that PartMC sets), e.g. for comparisons with sectional models.
any value below 1 is a statement about the particle's own hygroscopicity
rather than about mixing.
Relation to other PRs
partmc-libraryafter PR Compile with -O2 and avoid per-bin work-array allocation #2 (-O2 under gfortran, per-bin workarrays; merged), which changed no result.
xt-roundoff-tolerance: independent; touches other lines.Its effect is larger, and it removes the run-to-run noise that would
otherwise hide most of the effect of this change; hence the measurements
above on top of it.
🤖 Generated with Claude Code